Skip to content

vl53l: fix sensor model mismatch — component supports VL53L4CD/VL53L4CX, not VL53L0X#613

Merged
finger563 merged 2 commits intomainfrom
copilot/fix-model-id-mismatch
May 1, 2026
Merged

vl53l: fix sensor model mismatch — component supports VL53L4CD/VL53L4CX, not VL53L0X#613
finger563 merged 2 commits intomainfrom
copilot/fix-model-id-mismatch

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

The espp/vl53l component implements the VL53L4CD/VL53L4CX driver (16-bit register addressing, model ID 0xEB) but all documentation incorrectly identified the supported hardware as VL53L0X. Users with VL53L0X sensors (e.g., WHADDA WPSE337) got a misleading "Model ID mismatch" error because VL53L0X uses 8-bit register addressing and is fundamentally incompatible with this driver — the 16-bit register address 0x010F is misinterpreted, returning garbage values (0x0F, 0x01).

Documentation fixes

  • README.md, example/README.md, vl53l.rst: Replace all VL53L0X references with VL53L4CD/VL53L4CX; correct Adafruit product link to the VL53L4CD breakout (#5396); add explicit incompatibility notes for VL53L0X/VL53L1X users

Driver fixes (vl53l.hpp)

  • Split MODULE_TYPE = 0xAA into MODULE_TYPE_CD = 0xAA (VL53L4CD) and MODULE_TYPE_CX = 0x10 (VL53L4CX), so both variants are accepted in get_model_info()
  • Downgrade model ID mismatch from logger_.errorlogger_.warn since initialization proceeds regardless
  • Fix stale VL53L0X register name references in code comments

Tested on ESP32S3 with VL53L4CX dev board from adafruit:

image

Copilot AI linked an issue Apr 19, 2026 that may be closed by this pull request
2 tasks
…L4CD/VL53L4CX

- Update README.md and example/README.md to correctly reference VL53L4CD/VL53L4CX
  and add explicit note that VL53L0X is not supported
- Update doc/en/distance_sensors/vl53l.rst with correct sensor description
- Fix vl53l.hpp class description to reference VL53L4CD/VL53L4CX
- Add MODULE_TYPE_CD (0xAA) and MODULE_TYPE_CX (0x10) constants
- Update get_model_info() to accept both VL53L4CD and VL53L4CX module types
- Change model ID mismatch log level from error to warn (init proceeds anyway)
- Fix stale VL53L0X register reference comment in init()

Agent-Logs-Url: https://github.com/esp-cpp/espp/sessions/436039d8-973e-4dff-a1c0-2978dc50d395

Co-authored-by: finger563 <213467+finger563@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix model ID mismatch for VL53L0X sensor vl53l: fix sensor model mismatch — component supports VL53L4CD/VL53L4CX, not VL53L0X Apr 19, 2026
Copilot AI requested a review from finger563 April 19, 2026 23:32
@github-actions
Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

@finger563 finger563 marked this pull request as ready for review May 1, 2026 14:03
Copilot AI review requested due to automatic review settings May 1, 2026 14:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects the espp/vl53l component’s documentation and in-code identification logic to reflect that the driver is for VL53L4CD/VL53L4CX sensors (not VL53L0X), reducing user confusion around “model mismatch” messages.

Changes:

  • Update docs (component README, example README, Sphinx RST) to reference VL53L4CD/VL53L4CX and explicitly call out VL53L0X/VL53L1X incompatibility.
  • Adjust get_model_info() to accept both VL53L4CD and VL53L4CX module type values and downgrade mismatch logging from error → warn.
  • Clean up stale VL53L0X-related register/comment references in the driver.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
doc/en/distance_sensors/vl53l.rst Updates Sphinx documentation to describe VL53L4CD/VL53L4CX and adds incompatibility note.
components/vl53l/include/vl53l.hpp Updates Doxygen header docs, expands accepted module types, and adjusts mismatch logging.
components/vl53l/example/README.md Updates example documentation and fixes the referenced Adafruit breakout link/model.
components/vl53l/README.md Updates component README to reflect correct supported sensors and adds incompatibility note.

/// \note
/// This driver uses a 16-bit register addressing scheme as required by the
/// VL53L4CD and VL53L4CX. It is \b not compatible with the VL53L0X or
/// VL53L1X sensors, which use a different (8-bit) register map.
Comment on lines +8 to +11
is a Time-of-Flight (ToF) distance sensor. It is a sensor that can measure
distance from a target object without touching it. The sensor uses a laser to
send a pulse of light and measures the time it takes for the light to reflect
back to the sensor. The sensor can measure distance up to 1.3 meters (VL53L4CD)
@finger563 finger563 merged commit 0d9abf8 into main May 1, 2026
109 of 110 checks passed
@finger563 finger563 deleted the copilot/fix-model-id-mismatch branch May 1, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model ID mismatch

3 participants